import os
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'  # 必须放在导入tf之前!
from torch.utils.tensorboard import SummaryWriter

import tensorboard as tb

writer = SummaryWriter("logs")
for i in range(100):
    writer.add_scalar("y=2x", 2*i , i )
writer.close()

tb.notebook.start("--logdir logs/ --port 6007")